package com.unicom.controller.portal;

import com.unicom.common.ServerResponse;
import com.unicom.pojo.User;
import com.unicom.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

@Controller  //表明类别
@RequestMapping("/user/") //在访问的url前加上user
public class UserController {

    //将InterUserService注入进来
    @Autowired
    private IUserService iUserService;

    @RequestMapping(value = "login.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse<User> login(String username, String password, HttpSession session){
        ServerResponse<User> response = iUserService.login(username, password);
        return response;
    }

}
